<template>
  <a-date-picker v-model:value="value_" @change="startDateChange" showTime />
</template>
<script lang="ts">
  import { defineComponent, ref } from 'vue';
  import { DatePicker } from 'ant-design-vue';
  import { ConfigItem } from './control.data';
  import moment, { Moment } from 'moment';
  export default defineComponent({
    components: { [DatePicker.name]: DatePicker },
    props: {
      value: { type: String },
      config: { type: Object as PropType<ConfigItem>, default: () => ({} as ConfigItem) },
    },
    emits: ['update:value'],
    setup(props, { emit }) {
      let value_ = ref<Moment>(moment(props.value));
      const startDateChange = ({ dateString }) => {
        emit('update:value', dateString);
      };

      return {
        startDateChange,
        value_,
        moment,
      };
    },
  });
</script>
